import {
    HomeFilled, DataLine, DocumentCopy, GoodsFilled, User, List, Box, OfficeBuilding,
    Promotion, EditPen, Service, WalletFilled, PieChart, Setting, DocumentChecked
} from '@element-plus/icons-vue'

// 菜单项接口
export interface MenuItem {
    title: string
    path: string
    icon?: any
    children?: MenuItem[]
    badge?: number | string
    tag?: string
    tagType?: 'success' | 'warning' | 'danger' | 'info'
    external?: boolean
    disabled?: boolean
    hidden?: boolean
    permission?: string
    order?: number
    useGroup?: boolean // 是否使用分组显示
    groupThreshold?: number // 分组阈值
}

// 菜单配置
export const menuConfig: MenuItem[] = [
    {
        title: '工作台',
        icon: HomeFilled,
        path: '/',
        badge: 0,
        order: 1
    },
    {
        title: '数据看板',
        icon: DataLine,
        path: '/data-board',
        order: 2,
        children: [
            { title: '文案数据', icon: DocumentCopy, path: '/data-board/copywriting-data', badge: 12 },
            { title: '商品数据', icon: GoodsFilled, path: '/data-board/goods', badge: 5 },
            { title: '会员数据', icon: User, path: '/data-board/member-data', badge: 28 },
            { title: '积分数据', icon: WalletFilled, path: '/data-board/points-data', badge: 15 },
            { title: '优惠券数据', icon: Promotion, path: '/data-board/coupon-data', badge: 8 },
            { title: '仓储数据', icon: OfficeBuilding, path: '/data-board/warehouse-data', badge: 3 },
            { title: '客服数据', icon: Service, path: '/data-board/service-data', badge: 22 },
            { title: '商品推荐数据', path: '/data-board/recommend', badge: 7 }
        ]
    },
    {
        title: '会员管理',
        icon: User,
        path: '/member',
        order: 3,
        children: [
            { title: '会员管理', path: '/member/list', badge: 156, tag: '热门' },
            { title: '会员等级管理', path: '/member/level', badge: 8 },
            { title: '会员标签管理', path: '/member/tag', badge: 24 }
        ]
    },
    {
        title: '订单管理',
        icon: List,
        path: '/order',
        children: [],
        badge: 89,
        order: 4
    },
    {
        title: '商品管理',
        icon: Box,
        path: '/product',
        order: 5,
        children: [
            { title: '商品管理', path: '/product/list', badge: 234 },
            { title: '商品审核', path: '/product/audit', badge: 15, tag: '待处理', tagType: 'warning' as const },
            { title: '分类管理', path: '/product/category', badge: 45 },
            { title: '平台分类管理', path: '/product/platform-category', badge: 12 },
            { title: '商品标签', path: '/product/tag', badge: 67 },
            { title: '平台映射', path: '/product/platform-mapping', badge: 23 },
            { title: '商品推荐管理', path: '/product/recommend', badge: 18 }
        ]
    },
    {
        title: '仓储中心',
        icon: OfficeBuilding,
        path: '/warehouse',
        order: 6,
        children: [
            { title: '库位管理', path: '/warehouse/location', badge: 34 },
            { title: '仓库盘点', path: '/warehouse/inventory', badge: 7, tag: '进行中', tagType: 'success' as const }
        ]
    },
    {
        title: '运营管理',
        icon: Promotion,
        path: '/operation',
        order: 7,
        children: [
            { title: '文案管理', icon: EditPen, path: '/operation/copywriting-manage', badge: 45 },
            { title: '优惠券管理', path: '/operation/coupon', badge: 23 },
            { title: '优惠券领取情况', path: '/operation/coupon-receive', badge: 156 },
            { title: '首页装修', path: '/operation/home-design', badge: 3 },
            { title: '系统公告', path: '/operation/announcement-manage', badge: 12 },
            { title: '站点弹窗管理', path: '/operation/site-popup', badge: 0, tag: '弹窗', tagType: 'info' as const }
        ]
    },
    {
        title: '积分管理',
        icon: Box,
        path: '/points',
        order: 8,
        children: [
            { title: '日常任务管理', path: '/points/task', badge: 34 },
            { title: '营销活动管理', path: '/points/activity', badge: 8, tag: '新功能', tagType: 'success' as const },
            { title: '积分配置', path: '/points/config', badge: 5 },
            { title: '积分日志', path: '/points/log', badge: 234 },
            { title: '积分订单', path: '/points/order', badge: 67 },
            { title: '积分商品', path: '/points/goods', badge: 23 },
            { title: '积分统计', path: '/points/stat', badge: 12 },
            { title: '用户积分管理', path: '/points/user-manage', badge: 89 },
            { title: '风控管理', path: '/points/risk-control', badge: 3 }
        ]
    },
    {
        title: '客服中心',
        icon: Service,
        path: '/service',
        order: 9,
        children: [
            { title: '会话管理', path: '/service/session', badge: 45 },
            { title: '工单管理', path: '/service/ticket', badge: 23, tag: '紧急', tagType: 'danger' as const },
            { title: '客服管理', path: '/service/staff', badge: 12 },
            { title: '离职继承', path: '/service/handover', badge: 2 },
            { title: '客服满意度评价', path: '/service/satisfaction', badge: 67 },
            { title: '客服排班管理', path: '/service/scheduling', badge: 8 },
            { title: '知识库管理', path: '/service/knowledge', badge: 123 },
            { title: '快捷回复管理', path: '/service/quick-reply', badge: 45 },
            { title: '会话标签管理', path: '/service/tag', badge: 23 },
            { title: '客服绩效统计', path: '/service/performance', badge: 18 },
            { title: '机器人客服', path: '/service/robot', badge: 5, tag: 'AI', tagType: 'info' as const }
        ]
    },
    {
        title: '知识库',
        icon: DocumentCopy,
        path: '/knowledge',
        order: 10,
        children: [
            { title: '内容管理', path: '/knowledge/content', badge: 123 },
            { title: '分类管理', path: '/knowledge/category', badge: 34 },
            { title: '标签管理', path: '/knowledge/tag', badge: 56 },
            { title: '统计分析', path: '/knowledge/stat', badge: 12 }
        ]
    },
    {
        title: '财务管理',
        icon: WalletFilled,
        path: '/finance',
        badge: 34,
        order: 11
    },
    {
        title: '报表中心',
        icon: PieChart,
        path: '/report',
        badge: 12,
        order: 12
    },
    {
        title: '基础设置',
        icon: Setting,
        path: '/settings',
        order: 13,
        useGroup: true, // 使用分组显示
        groupThreshold: 8, // 超过8项时分组
        children: [
            // 人员管理组
            { title: '员工管理', path: '/settings/staff', badge: 23, order: 1 },
            { title: '角色管理', path: '/settings/role', badge: 8, order: 2 },
            // 站点管理组
            { title: '站点管理', path: '/settings/site', badge: 3, order: 3 },
            { title: '账号管理', path: '/settings/account', badge: 12, order: 4 },
            // 服务管理组
            { title: '收费管理', path: '/settings/extra-service', badge: 5, order: 5 },
            { title: '附加服务', path: '/settings/additional-service', badge: 7, order: 6 },
            // 物流管理组
            { title: '国际物流运费规则', path: '/settings/freight-rule', badge: 15, order: 7 },
            // 系统配置组
            { title: '工作流配置', path: '/settings/workflow', badge: 8, order: 8 },
            { title: '卖家管理', path: '/settings/seller', badge: 12, order: 9 },
            { title: '包裹设置', path: '/settings/package', badge: 6, order: 10 },
            { title: '汇率管理', path: '/settings/exchange', badge: 3, order: 11 },
            { title: '推送方式管理', path: '/settings/push-method', badge: 4, order: 12 },
            { title: '多语言管理', path: '/settings/language', badge: 0, order: 13 }
        ]
    },
    {
        title: '操作日志',
        icon: DocumentChecked,
        path: '/log',
        badge: 89,
        order: 14
    },
    {
        title: '帮助文档',
        path: 'https://docs.example.com',
        icon: DocumentCopy,
        external: true,
        tag: '外部',
        tagType: 'info' as const,
        order: 15
    }
]

// 菜单分组配置
export const menuGroupConfig = {
    // 基础设置菜单分组规则
    settings: {
        '人员管理': ['管理', '员工', '角色'],
        '站点管理': ['站点', '账号'],
        '服务管理': ['收费', '服务'],
        '物流管理': ['物流', '运费', '包裹'],
        '系统配置': ['工作流', '卖家', '汇率', '推送']
    }
}

// 菜单优化配置
export const menuOptimizationConfig = {
    maxDepth: 3, // 最大深度
    maxChildrenPerLevel: 8, // 每层最大子项数
    useGrouping: true, // 是否启用分组
    groupThreshold: 8, // 分组阈值
    enableSearch: true, // 是否启用搜索
    enableCollapse: true, // 是否启用折叠
    enableBadges: true, // 是否启用徽章
    enableTags: true // 是否启用标签
}

// 导出菜单配置
export default menuConfig

